#include <iostream>
#include <string>
#include <regex>

int main() 
{
    std::string str = "get /bitejiuyeke/login?user=xiaoming&pass=123123 HTTP/1.1\r\n";
    std::smatch matches;
    std::regex e("(GET|HEAD|POST|PUT|DELETE) ([^?]*)(?:\\?(.*))? (HTTP/1\\.[01])(?:\n|\r\n)?.*",std::regex::icase);
    bool ret = std::regex_match(str, matches, e);
    // _request._method = matches[1];
    //         std::transform(_request._method.begin(), _request._method.end(), _request._method.begin(), ::toupper);
    if (ret == false) {
        std::cout<<"匹配错误"<<std::endl;
    }
    std::cout<<matches.size()<<std::endl;
    std::string method=matches[1];
    std::cout<<method<<std::endl;
    std::transform(method.begin(), method.end(), method.begin(), ::toupper);
    std::cout<<method<<std::endl;
    for(int i=0;i<matches.size();i++)
    {
        std::cout<<i<<" "<<matches[i]<<std::endl;
    }
    // for (auto &s : matches) {
    //     std::cout << s << std::endl;
    // }
    return 0;
}